/*!
 * Project's name: Ziemianie
 * Supervisor: mgr Tomasz Kornuta, Warsaw University of Technology
 * File's autors: Michal Plutecki, G1ISI, Warsaw University of Technology
 * Date: 3-12-2008
 * Description:
 * 	SCZR Coursework
 * 	Team: Jakub Rosiak, Michal Lisiecki, Michal Plutecki
 * 	Warsaw University of Technology
 * */

#ifndef DBKLEWKI_H_
#define DBKLEWKI_H_

#include <stdio.h>
#include <vector>
#include <string>
#include <stdexcept>

extern "C" {
#include "sqlite3.h"
}

struct ConnectionException : public std::logic_error {
	ConnectionException(const std::string &message) : std::logic_error(message) { }
};

/*!
 * \brief
 * Class used to open, operate on a database
 * 
 * \see
 * DBConnection
 * */
class DBKlewki
{
public:
	std::vector<std::string> vcol_head;
	std::vector<std::string> vdata;
	int ref_count;
	
	DBKlewki();
	DBKlewki(std::string tableName);
	~DBKlewki();
	
	bool exe(std::string s_exe);
	
private:
	sqlite3 *db_; //database pointer
	char *zErrMsg_; //error message
	char **result_; //result table
	int rc_;
	int nrow_, ncol_;
	int db_open_;
};

#endif /*DBKLEWKI_H_*/
